<%@page import="cn.kgc.service.impl.NewsServiceImpl"%>
<%@page import="cn.kgc.service.NewsService"%>
<%@page import="cn.kgc.entity.Detail"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%
	//防止编码错误
	request.setCharacterEncoding("utf-8");
	Detail news = new Detail();
	//接收页面传来的值
	news.setCategoryid(Integer.parseInt(request.getParameter("categoryId")));
	news.setTitle(request.getParameter("title"));
	news.setAuthor(request.getParameter("author"));
	news.setSummary(request.getParameter("summery"));
	news.setContent(request.getParameter("newscontent"));
	news.setPicPath(request.getParameter("picpath"));
	NewsService service = new NewsServiceImpl();
	int update = service.addNews(news);
	if(update>0){
		System.out.println("插入成功");
		response.sendRedirect("newsDetailList.jsp");
	}else{
		System.out.println("插入失败了………………");
	}
	
	%>
</body>
</html>